﻿using System.Web.Mvc;
using Pay.DTO;
using Pay.IService;
using Pay.TO;
using Pay.Core;
using System;



namespace Pay.Web.Areas.Admin.Controllers
{
    [RouteArea("admin")]
    [RoutePrefix("declaration")]
    public class DeclarationController : AdminController {
        private IMerchantDeclarationService _iMerchantDeclarationService;
        private IEntrepotService _iEntrepotService;
        public DeclarationController(IMerchantDeclarationService iMerchantDeclarationService, IEntrepotService iEntrepotService) {
            _iMerchantDeclarationService = iMerchantDeclarationService;
            _iEntrepotService = iEntrepotService;
        }
        ///// <summary>
        ///// 商户入驻列表
        ///// </summary>
        ///// <param name="query"></param>
        ///// <returns></returns>
        //public JsonResult Gets(MerchantDeclarationQuery query) {
        //    var model = _iMerchantDeclarationService.GetMerchantDeclarations(query);
        //    return Json(ResultToJson.Json(model), JsonRequestBehavior.AllowGet);
        //}
        ///// <summary>
        ///// 商户入驻信息
        ///// </summary>
        ///// <param name="query"></param>
        ///// <returns></returns>
        //public JsonResult Get(MerchantDeclarationQuery query) {
        //    var model = _iMerchantDeclarationService.GetMerchantDeclaration(query);
        //    return Json(ResultToJson.Json(model), JsonRequestBehavior.AllowGet);
        //}
        ///// <summary>
        ///// 获取手机编号
        ///// </summary>
        ///// <param name="id"></param>
        ///// <returns></returns>
        //public JsonResult GetCode() {
        //    var code = WebHelper.GetAreaCode().Values;
        //    return Json(ResultToJson.Json(code), JsonRequestBehavior.AllowGet);
        //}
        ///// <summary>
        ///// 商户修改
        ///// </summary>
        ///// <param name="dto"></param>
        ///// <returns></returns>
        //public JsonResult Alter(merchant_declaration_dto dto) {
        //    var model = _iMerchantDeclarationService.AlterMerchantDeclaration(dto);
        //    return Json(ResultToJson.Json(model >=0 ? "修改成功" : "修改失败", model), JsonRequestBehavior.AllowGet);
        //}
        ///// <summary>
        ///// 商户审核
        ///// </summary>
        ///// <param name="dto"></param>
        ///// <returns></returns>
        //public JsonResult Audit(merchant_declaration_dto dto) {
        //    var model = _iMerchantDeclarationService.AuditMerchantDeclaration(dto);
        //    return Json(ResultToJson.Json(model >= 0 ? "操作成功" : "操作失败", model), JsonRequestBehavior.AllowGet);
        //}
        ///// <summary>
        ///// 商户删除
        ///// </summary>
        ///// <param name="id"></param>
        ///// <returns></returns>
        //public JsonResult Delete(long id) {
        //    var model = _iMerchantDeclarationService.DeleteMerchantDeclaration(id);
        //    return Json(ResultToJson.Json(model >= 0 ? "删除成功" : "删除失败", model), JsonRequestBehavior.AllowGet);
        //}

        /// <summary>
        /// 获取集散中心
        /// </summary>
        /// <returns></returns>
        public JsonResult GetEntrepot() {
            var result = _iEntrepotService.GetAll();
            return Json(ResultToJson.Json(result),JsonRequestBehavior.AllowGet);
        }
    }
}